listData = [
    [1, [12, 123, 132, 14, 342], [12, 123, 132, 14, 342], 25],
    [1, [12, 123, 132, 14, 342], [12, 123, 132, 14, 342], 25],
    [1, [12, 123, 132, 14, 342], [12, 123, 132, 14, 342], 25],
    [1, [12, 123, 132, 14, 342], [12, 123, 132, 14, 342], 25],
    [1, [12, 123, 132, 14, 342], [12, 123, 132, 14, 342], 25],
    [2, [121, 123, 132, 14, 342], [12, 123, 132, 14, 342], 25],
    [2, [121, 123, 132, 14, 342], [12, 123, 132, 14, 342], 25],
    [2, [121, 123, 132, 14, 342], [12, 123, 132, 14, 342], 25],
    [2, [121, 123, 132, 14, 342], [12, 123, 132, 14, 342], 25],
    [2, [121, 123, 132, 14, 342], [12, 123, 132, 14, 342], 25],
    [3, [1222, 123, 132, 14, 342], [12, 123, 132, 14, 342], 35],
    [3, [1232, 123, 132, 14, 342], [12, 123, 132, 14, 342], 45],
    [3, [1234, 123, 132, 14, 342], [12, 123, 132, 14, 342], 55],
    [3, [1267, 123, 132, 14, 342], [12, 123, 132, 14, 342], 65],
    [3, [1289, 123, 132, 14, 342], [12, 123, 132, 14, 342], 75]
]

def test(listData):
    object_dict = {}
    for record_window_batch in listData:
        windowId = record_window_batch[0]
        object_ref = record_window_batch[1]
        owner_address = record_window_batch[2]
        if object_dict.get(windowId,0) == 0:
            object_dict[windowId] = [object_ref]
        else:
            object_dict[windowId].append(object_ref)
        if len(object_dict[windowId]) == 5:
            train_ref_list = object_dict[windowId]
            print(train_ref_list)

if __name__ == '__main__':
    test(listData)








